package com.jwds.digital.bios.business.integration.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.jwds.digital.bios.business.core.infrastructure.dto.external.WarehouseStorageDTO;
import com.jwds.digital.bios.business.core.infrastructure.dto.feign.BasicStockBinReqDTO;
import com.jwds.digital.bios.business.core.infrastructure.vo.feign.BasicStockBinRespVO;
import com.jwds.digital.bios.business.integration.service.ExternalDataProcess;
import com.jwds.digital.bios.business.rpc.feign.BasicStockBinFeign;
import com.jwds.tdc.framework.common.exception.BusinessException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

/**
 * 料仓和料棚信息
 * @Author lizhiming
 */
@Service
public class L32BC08 implements ExternalDataProcess {

    @Autowired
    BasicStockBinFeign basicStockBinFeign;

    @Override
    public String getMessageId() {
        return this.getClass().getSimpleName();
    }

    @Override
    public void addProcess(Object dataObj) throws BusinessException {
        //此接口无法接受入库业务
    }

    @Override
    public void updateProcess(Object dataObj) throws BusinessException {
        WarehouseStorageDTO warehouseStorageDTO = BeanUtil.toBean(dataObj, WarehouseStorageDTO.class);
        //todo 更新
        ArrayList<BasicStockBinReqDTO> basicStockBinRespVOList = new ArrayList<>();
        BasicStockBinReqDTO basicStockBinReqDTO = new BasicStockBinReqDTO();
        BeanUtil.copyProperties(warehouseStorageDTO, basicStockBinReqDTO);
        basicStockBinRespVOList.add(basicStockBinReqDTO);
        basicStockBinFeign.batchUpdate(basicStockBinRespVOList);
    }

    @Override
    public void deleteProcess(Object dataObj) throws BusinessException {
        //此接口无法接受删除业务
    }
}
